package com.easy.west.westclient.api.vodcommen.api;

import android.content.Context;
import android.support.annotation.NonNull;

import com.easy.west.westclient.api.base.callback.BaseCallBack;
import com.easy.west.westclient.api.base.impl.BaseImpl;
import com.easy.west.westclient.api.vodcommen.bean.CommenList;
import com.easy.west.westclient.api.vodcommen.event.GetVodCommenListEvent;
import com.easy.west.westclient.api.vodcommen.event.SendLiveCommenEvent;
import com.easy.west.westclient.api.vodcommen.event.SendVodCommenEvent;
import com.easy.west.westclient.util.UUIDGenerator;

public class VodCommenImpl extends BaseImpl<VodCommenService> implements VodCommenApi{
    public VodCommenImpl(@NonNull Context context) {
        super(context);
    }

    @Override
    public String getCommens(long vid,int num) {
        String uuid = UUIDGenerator.getUUID();
        service.getVodCommen(vid,num).enqueue(new BaseCallBack<CommenList>(new GetVodCommenListEvent(uuid)));
        return uuid;
    }

    @Override
    public String sendLiveCommens(long lid, long owner_id, String access_token, long target_id, int type, String content) {
        String uuid = UUIDGenerator.getUUID();
        service.sendLiveCommen(lid,owner_id,access_token,target_id,type,content)
                .enqueue(new BaseCallBack<Boolean>(new SendLiveCommenEvent(uuid)));
        return uuid;
    }

    @Override
    public String sendVodCommens(long vod, long owner_id, String access_token, long target_id, int type, String content) {
        String uuid = UUIDGenerator.getUUID();
        service.sendVodCommen(vod,owner_id,access_token,target_id,type,content)
                .enqueue(new BaseCallBack<>(new SendVodCommenEvent(uuid)));
        return uuid;
    }
}
